#pragma once
#include <SimpleDef.h>

#ifdef _8042_
#define KEYBOARD_INPUT_PORT (0x60)
#endif

/* 键盘输入环形缓冲区 */
typedef struct __KeyboardInputBuffer
{
    DWORD dwBufferSize;
    LPBYTE lpBuffer;
    DWORD dwFront;
    DWORD dwRear;
} KeyboardInputBuffer, *LPKeyboardInputBuffer;

extern LPKeyboardInputBuffer g_lpKeyboardInputBuffer;

LPKeyboardInputBuffer CreateKeyboardInputBuffer(DWORD dwBufferSize);
void DestroyKeyboardInputBuffer(LPKeyboardInputBuffer lpKeyboardInputBuffer);
static inline BOOL IsKeyboardInputBufferEmpty(LPKeyboardInputBuffer lpKeyboardInputBuffer)
{
    return lpKeyboardInputBuffer->dwRear == lpKeyboardInputBuffer->dwFront;
}
void AppendCharToKeyboardInputBuffer(LPKeyboardInputBuffer lpKeyboardInputBuffer);
CHAR RetrieveCharFromKeyboardInputBuffer(LPKeyboardInputBuffer lpKeyboardInputBuffer);
